home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / ImageCompression.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  26.9 KB  |  618 lines  |  [TEXT/MPS ]

  1. { All rights reserved
  2.  
  3. Created: Tuesday, October 13, 1992 at 4:31 PM
  4.  ImageCompression.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.  Copyright Apple Computer, Inc. 1991, 1992
  8.  All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT ImageCompression;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingImageCompression}
  22. {$SETC UsingImageCompression := 1}
  23.  
  24. {$I+}
  25. {$SETC ImageCompressionIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingQuickDraw}
  28. {$I $$Shell(PInterfaces)QuickDraw.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingQDOffscreen}
  31. {$I $$Shell(PInterfaces)QDOffscreen.p}
  32. {$ENDC}
  33. {$IFC UNDEFINED UsingTypes}
  34. {$I $$Shell(PInterfaces)Types.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED UsingComponents}
  37. {$I $$Shell(PInterfaces)Components.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED UsingStandardFile}
  40. {$I $$Shell(PInterfaces)StandardFile.p}
  41. {$ENDC}
  42. {$SETC UsingIncludes := ImageCompressionIncludes}
  43.  
  44. CONST
  45. gestaltCompressionMgr = 'icmp';
  46.  
  47. TYPE
  48. {  Matrix stuff  }
  49. MatrixRecord = RECORD
  50.  matrix: ARRAY [0..2,0..2] OF Fixed;
  51.  END;
  52. MatrixRecordPtr = ^MatrixRecord;
  53.  
  54. FixedPoint = RECORD
  55.  x: Fixed;
  56.  y: Fixed;
  57.  END;
  58.  
  59. FixedRect = RECORD
  60.  left: Fixed;
  61.  top: Fixed;
  62.  right: Fixed;
  63.  bottom: Fixed;
  64.  END;
  65.  
  66. CONST
  67. { These are the bits that are set in the Component flags, and also in the codecInfo struct. }
  68.  
  69. codecInfoDoes1 = $1;                    { codec can work with 1-bit pixels }
  70. codecInfoDoes2 = $2;                    { codec can work with 2-bit pixels }
  71. codecInfoDoes4 = $4;                    { codec can work with 4-bit pixels }
  72. codecInfoDoes8 = $8;                    { codec can work with 8-bit pixels }
  73. codecInfoDoes16 = $10;                    { codec can work with 16-bit pixels }
  74. codecInfoDoes32 = $20;                    { codec can work with 32-bit pixels }
  75. codecInfoDoesDither = $40;                { codec can do ditherMode }
  76. codecInfoDoesStretch = $80;                { codec can stretch to arbitrary sizes }
  77. codecInfoDoesShrink = $100;                { codec can shrink to arbitrary sizes }
  78. codecInfoDoesMask = $200;                { codec can mask to clipping regions }
  79.  
  80. codecInfoDoesTemporal = $400;            { codec can handle temporal redundancy }
  81.  
  82. codecInfoDoesDouble = $800;                { codec can stretch to double size exactly }
  83. codecInfoDoesQuad = $1000;                { codec can stretch to quadruple size exactly }
  84. codecInfoDoesHalf = $2000;                { codec can shrink to half size }
  85. codecInfoDoesQuarter = $4000;            { codec can shrink to quarter size }
  86.  
  87. codecInfoDoesRotate = $8000;            { codec can rotate on decompress }
  88. codecInfoDoesHorizFlip = $10000;        { codec can flip horizontally on decompress }
  89. codecInfoDoesVertFlip = $20000;            { codec can flip vertically on decompress }
  90. codecInfoDoesSkew = $40000;                { codec can skew on decompress }
  91. codecInfoDoesBlend = $80000;            { codec can blend on decompress }
  92. codecInfoDoesWarp = $100000;            { codec can warp arbitrarily on decompress }
  93. codecInfoDoesRecompress = $200000;        { codec can recompress image without accumulating errors }
  94. codecInfoDoesSpool = $400000;            { codec can spool image data }
  95. codecInfoDoesRateConstrain = $800000;
  96.  
  97. codecInfoDepth1 = $1;                    { compressed data at 1 bpp depth available }
  98. codecInfoDepth2 = $2;                    { compressed data at 2 bpp depth available }
  99. codecInfoDepth4 = $4;                    { compressed data at 4 bpp depth available }
  100. codecInfoDepth8 = $8;                    { compressed data at 8 bpp depth available }
  101. codecInfoDepth16 = $10;                    { compressed data at 16 bpp depth available }
  102. codecInfoDepth32 = $20;                    { compressed data at 32 bpp depth available }
  103. codecInfoDepth24 = $40;                    { compressed data at 24 bpp depth available }
  104. codecInfoDepth33 = $80;                    { compressed data at 1 bpp monochrome depth  available }
  105. codecInfoDepth34 = $100;                { compressed data at 2 bpp grayscale depth available }
  106. codecInfoDepth36 = $200;                { compressed data at 4 bpp grayscale depth available }
  107. codecInfoDepth40 = $400;                { compressed data at 8 bpp grayscale depth available }
  108. codecInfoStoresClut = $800;                { compressed data can have custom cluts }
  109. codecInfoDoesLossless = $1000;            { compressed data can be stored in lossless format }
  110. codecInfoSequenceSensitive = $2000;
  111.  
  112. codecFlagUseImageBuffer = $1;            { (input) allocate buffer for whole image on decompress sequence }
  113. codecFlagUseScreenBuffer = $2;            { (input) allocate buffer for screen on decompress sequence for faster updates }
  114. codecFlagUpdatePrevious = $4;            { (input) udate previous buffer on compress sequence }
  115. codecFlagNoScreenUpdate = $8;            { (input) dont update screen, but do update image buffer if allocated }
  116. codecFlagWasCompressed = $10;            { (input) hint to compressor that image was previously compressed }
  117. codecFlagDontOffscreen = $20;            { (input) return error instead of automatically going offscreen }
  118. codecFlagUpdatePreviousComp = $40;        { (input) udate previous buffer on compress sequence }
  119. codecFlagForceKeyFrame = $80;            { (input) when sent to CompressSequenceFrame, forces that frame to be a key frame }
  120. codecFlagOnlyScreenUpdate = $100;        { (input) only update screen from }
  121. codecFlagLiveGrab    = $200;                { (input) data being compressed is from live source (speed is critical) }
  122. codecFlagDontUseNewImageBuffer = $400;     { (input) return error if image buffer is new or reallocated }
  123. codecFlagInterlaceUpdate = $800;        { (input) use interlaced update }
  124.  
  125.  
  126. codecFlagUsedNewImageBuffer    = $4000;    { (output) indicates that image buffer was first used on this decompress sequence }
  127. codecFlagUsedImageBuffer = $8000;        { (output) indicates that image buffer was used on this decompress sequence }
  128.  
  129. codecErr = -8960;                        { the codec returned an error }
  130. noCodecErr = -8961;                        { the specified codec could not be found }
  131. codecUnimpErr = -8962;                    { this feature is not implemented by the specified codec }
  132. codecSizeErr = -8963;
  133. codecScreenBufErr = -8964;                { the screen buffer could not be allocated }
  134. codecImageBufErr = -8965;                { the image buffer could not be allocated }
  135. codecSpoolErr = -8966;                    { the compressed data must be in memory (spooling did not work) }
  136. codecAbortErr = -8967;                    { the operation was aborted by the progress proc }
  137. codecWouldOffscreenErr = -8968;            { an offscreen access would have been used, but wasn't allowed because codecFlagDontOffscreen was set }
  138. codecBadDataErr = -8969;                { compressed data was found to have inconsistencies }
  139. codecDataVersErr = -8970;                { compressed data was of a format version that codec couldn't handle }
  140. codecExtensionNotFoundErr = -8971;
  141. codecConditionErr = -8972;                { codec can not do requested operation }
  142. codecOpenErr = -8973;                    { the codec  could not be opened }
  143.  
  144. codecMinimumDataSize = 32768;            { The minimum data size for spooling in or out data }
  145.  
  146. compressorComponentType = 'imco';        { the type for "Components" which compress images }
  147. decompressorComponentType = 'imdc';        { the type for "Components" which decompress images }
  148.  
  149. TYPE
  150. CompressorComponent = Component;        { a Component which compresses images }
  151. DecompressorComponent = Component;        { a Component which decompresses images }
  152. CodecComponent = Component;                { a Component which decompresses or compresses images }
  153.  
  154. CONST
  155. anyCodec                 =  0;            { take first working codec of given type }
  156. bestSpeedCodec             = -1;            { take fastest codec of given type }
  157. bestFidelityCodec        = -2;            { take codec which is most accurate}
  158. bestCompressionCodec    = -3;            { take codec of given type that is most accurate }
  159.  
  160. TYPE
  161. CodecType = OsType;                    { type descriptor for codecs i.e: 'appl','jpeg','rle ' }
  162.  
  163. CodecFlags = INTEGER;                    { flags for codec manager calls }
  164.  
  165. CodecQ = LONGINT;
  166.  
  167. CONST
  168. codecLosslessQuality    = $400;
  169. codecMaxQuality            = $3FF;
  170. codecMinQuality            = $000;
  171. codecLowQuality            = $100;
  172. codecNormalQuality        = $200;
  173. codecHighQuality        = $300;
  174.  
  175. TYPE
  176. DataProcPtr = ProcPtr;
  177. FlushProcPtr = ProcPtr;
  178. CompletionProcPtr = ProcPtr;
  179.  
  180. CONST
  181. codecCompletionSource = 1;                { asynchronous codec is done with source data  }
  182. codecCompletionDest = 2;                { asynchronous codec is done with destination data  }
  183.  
  184. TYPE
  185. ProgressProcPtr = ProcPtr;
  186.  
  187. CONST
  188. codecProgressOpen = 0;
  189. codecProgressUpdatePercent = 1;
  190. codecProgressClose = 2;
  191.  
  192. TYPE
  193. StdPixProcPtr = ProcPtr;
  194.  
  195. ImageSequence = LONGINT;
  196.  
  197. ProgressProcRecordPtr = ^ProgressProcRecord;
  198. ProgressProcRecord = RECORD
  199.  progressProc: ProgressProcPtr;
  200.  progressRefCon: LONGINT;
  201.  END;
  202.  
  203. CompletionProcRecordPtr = ^CompletionProcRecord;
  204. CompletionProcRecord = RECORD
  205.  completionProc: CompletionProcPtr;
  206.  completionRefCon: LONGINT;
  207.  END;
  208.  
  209. DataProcRecordPtr = ^DataProcRecord;
  210. DataProcRecord = RECORD
  211.  dataProc: DataProcPtr;
  212.  dataRefCon: LONGINT;
  213.  END;
  214.  
  215. FlushProcRecordPtr = ^FlushProcRecord;
  216. FlushProcRecord = RECORD
  217.  flushProc: FlushProcPtr;
  218.  flushRefCon: LONGINT;
  219.  END;
  220.  
  221.  
  222. AlignmentProcPtr = ProcPtr;
  223.  
  224. AlignmentProcRecordPtr = ^AlignmentProcRecord;
  225. AlignmentProcRecord = RECORD
  226.     alignmentProc: AlignmentProcPtr;
  227.     alignmentRefCon: LONGINT;
  228.  END;
  229.  
  230. DataRateParamsPtr = ^DataRateParams;
  231. DataRateParams = RECORD
  232.     dataRate: LONGINT;
  233.     dataOverrun: LONGINT;
  234.     frameDuration: LONGINT;
  235.     keyFrameRate: LONGINT;
  236.     minSpatialQuality: CodecQ;
  237.     minTemporalQuality: CodecQ;
  238.  END;
  239.  
  240.  
  241.     The ImageDescription is private data which is produced when an image or sequence 
  242.     is compressed. It fully describes the format of the compressed data.}
  243.  
  244. ImageDescriptionPtr = ^ImageDescription;
  245. ImageDescriptionHandle = ^ImageDescriptionPtr;
  246. ImageDescription = PACKED RECORD
  247.  idSize: LONGINT;                        { total size of ImageDescription including extra data ( CLUTs and other per sequence data }
  248.  cType: CodecType;                        { what kind of codec compressed this data }
  249.  resvd1: LONGINT;                        { reserved for apple use }
  250.  resvd2: INTEGER;                        { reserved for apple use }
  251.  dataRefIndex: INTEGER;                    { set to zero }
  252.  version: INTEGER;                        { which version is this data }
  253.  revisionLevel: INTEGER;                { what version of that codec did this }
  254.  vendor: LONGINT;                        { whose  codec compressed this data }
  255.  temporalQuality: CodecQ;                { what was the temporal quality factor          }
  256.  spatialQuality: CodecQ;                { what was the spatial quality factor          }
  257.  width: INTEGER;                        { how many pixels wide is this data }
  258.  height: INTEGER;                        { how many pixels high is this data }
  259.  hRes: Fixed;                            { horizontal resolution }
  260.  vRes: Fixed;                            { vertical resolution }
  261.  dataSize: LONGINT;                        { if known, the size of data for this image descriptor }
  262.  frameCount: INTEGER;                    { number of frames this description applies to }
  263.  name: PACKED ARRAY [0..31] OF CHAR;    { name of codec ( in case not installed ) }
  264.  depth: INTEGER;                        { what depth is this data (1-32) or ( 33-40 grayscale ) }
  265.  clutID: INTEGER;                        { clut id or if 0 clut follows  or -1 if no clut }
  266.  END;
  267.  
  268.     The CodecInfo is the information returned as the codecInfo struct by a codec Component
  269.     to the codec manager or to the caller. It is specific to the particular codec
  270.     implementation and not to the codec type.}
  271.  
  272. CodecInfo = PACKED RECORD
  273.  typeName: PACKED ARRAY [0..31] OF CHAR;{ name of the codec type i.e.: 'Apple Image Compression' }
  274.  version: INTEGER;                        { version of the codec data that this codec knows about }
  275.  revisionLevel: INTEGER;                { revision level of this codec i.e: 0x00010001 (1.0.1) }
  276.  vendor: LONGINT;                        { Maker of this codec i.e: 'appl' }
  277.  decompressFlags: LONGINT;                { codecInfo flags for decompression capabilities }
  278.  compressFlags: LONGINT;                { codecInfo flags for compression capabilities }
  279.  formatFlags: LONGINT;                    { codecInfo flags for compression format details }
  280.  compressionAccuracy: CHAR;                { measure (1-255) of accuracy of this codec for compress (0 if unknown) }
  281.  decompressionAccuracy: CHAR;            { measure (1-255) of accuracy of this codec for decompress (0 if unknown) }
  282.  compressionSpeed: INTEGER;                { ( millisecs for compressing 320x240 on base mac II) (0 if unknown) }
  283.  decompressionSpeed: INTEGER;            { ( millisecs for decompressing 320x240 on mac II)(0 if unknown) }
  284.  compressionLevel: CHAR;                { measure (1-255) of compression level of this codec (0 if unknown) }
  285.  resvd: CHAR;                            { pad }
  286.  minimumHeight: INTEGER;                { minimum height of image (block size) }
  287.  minimumWidth: INTEGER;                    { minimum width of image (block size) }
  288.  decompressPipelineLatency: INTEGER;    { in milliseconds ( for asynchronous codecs ) }
  289.  compressPipelineLatency: INTEGER;        { in milliseconds ( for asynchronous codecs ) }
  290.  privateData: LONGINT;
  291.  END;
  292.  
  293. { Name list returned by GetCodecNameList. }
  294. CodecNameSpec = PACKED RECORD
  295.  codec: CodecComponent;
  296.  cType: CodecType;
  297.  typeName: PACKED ARRAY [0..31] OF CHAR;
  298.  name: Handle;
  299.  END;
  300.  
  301. CodecNameSpecListPtr = ^CodecNameSpecList;
  302. CodecNameSpecList = RECORD
  303.  count: INTEGER;
  304.  list: ARRAY [0..0] OF CodecNameSpec;
  305.  END;
  306.  
  307. CONST
  308. defaultDither    = 0;
  309. forceDither        = 1;
  310. suppressDither    = 2;
  311.  
  312.  
  313. FUNCTION CodecManagerVersion(VAR version: LONGINT): OSErr;
  314.  INLINE $7000,$AAA3;
  315. FUNCTION GetCodecNameList(VAR list: CodecNameSpecListPtr;showAll: INTEGER): OSErr;
  316.  INLINE $7001,$AAA3;
  317. FUNCTION DisposeCodecNameList(list: CodecNameSpecListPtr): OSErr;
  318. INLINE  $700F,$AAA3;
  319. FUNCTION GetCodecInfo(VAR info: CodecInfo;cType: CodecType;codec: CodecComponent): OSErr;
  320.  INLINE $7003,$AAA3;
  321. FUNCTION GetMaxCompressionSize(src: PixMapHandle;srcRect: Rect;colorDepth: INTEGER;
  322.  quality: CodecQ;cType: CodecType;codec: CompressorComponent;VAR size: LONGINT): OSErr;
  323.  INLINE $7004,$AAA3;
  324. FUNCTION GetCompressionTime(src: PixMapHandle; srcRect: Rect;colorDepth: INTEGER;
  325.  cType: CodecType;codec: CompressorComponent;VAR spatialQuality: CodecQ;
  326.  VAR temporalQuality: CodecQ;VAR compressTime: LONGINT): OSErr;
  327.  INLINE $7005,$AAA3;
  328. FUNCTION CompressImage(src: PixMapHandle; srcRect: Rect;quality: CodecQ;
  329.  cType: CodecType;desc: ImageDescriptionHandle;data: Ptr): OSErr;
  330.  INLINE $7006,$AAA3;
  331. FUNCTION FCompressImage(src: PixMapHandle; srcRect: Rect;colorDepth: INTEGER;
  332.  quality: CodecQ;cType: CodecType;codec: CompressorComponent;clut: CTabHandle;
  333.  flags: CodecFlags;bufferSize: LONGINT;flushProc: FlushProcRecordPtr;progressProc: ProgressProcRecordPtr;
  334.  desc: ImageDescriptionHandle;data: Ptr): OSErr;
  335.  INLINE $7007,$AAA3;
  336. FUNCTION DecompressImage(data: Ptr;desc: ImageDescriptionHandle;dst: PixMapHandle;
  337.   srcRect: Rect; dstRect: Rect;mode: INTEGER;mask: RgnHandle): OSErr;
  338.  INLINE $7008,$AAA3;
  339. FUNCTION FDecompressImage(data: Ptr;desc: ImageDescriptionHandle;dst: PixMapHandle;
  340.   srcRect: Rect;matrix: MatrixRecordPtr;mode: INTEGER;mask: RgnHandle;
  341.  matte: PixMapHandle; matteRect: Rect;accuracy: CodecQ;codec: DecompressorComponent;
  342.  bufferSize: LONGINT;dataProc: DataProcRecordPtr;progressProc: ProgressProcRecordPtr): OSErr;
  343.  INLINE $7009,$AAA3;
  344. FUNCTION CompressSequenceBegin(VAR seqID: ImageSequence;src: PixMapHandle;
  345.  prev: PixMapHandle; srcRect: Rect; prevRect: Rect;colorDepth: INTEGER;
  346.  cType: CodecType;codec: CompressorComponent;spatialQuality: CodecQ;temporalQuality: CodecQ;
  347.  keyFrameRate: LONGINT;clut: CTabHandle;flags: CodecFlags;desc: ImageDescriptionHandle): OSErr;
  348.  INLINE $700A,$AAA3;
  349. FUNCTION CompressSequenceFrame(seqID: ImageSequence;src: PixMapHandle; srcRect: Rect;
  350.  flags: CodecFlags;data: Ptr;VAR dataSize: LONGINT;VAR similarity: Byte;
  351.  asyncCompletionProc: CompletionProcRecordPtr): OSErr;
  352.   INLINE $206F,$0004,$4250,$52AF,$0004,$700B,$AAA3;
  353. FUNCTION DecompressSequenceBegin(VAR seqID: ImageSequence;desc: ImageDescriptionHandle;
  354.  port: CGrafPtr;gdh: GDHandle; srcRect: Rect;matrix: MatrixRecordPtr;
  355.  mode: INTEGER;mask: RgnHandle;flags: CodecFlags;accuracy: CodecQ;codec: DecompressorComponent): OSErr;
  356.  INLINE $700D,$AAA3;
  357. FUNCTION DecompressSequenceFrame(seqID: ImageSequence;data: Ptr;inFlags: CodecFlags;
  358.  VAR outFlags: CodecFlags;asyncCompletionProc: CompletionProcRecordPtr): OSErr;
  359.  INLINE $700E,$AAA3;
  360. FUNCTION SetDSequenceMatrix(seqID: ImageSequence;matrix: MatrixRecordPtr): OSErr;
  361.  INLINE $7010,$AAA3;
  362. FUNCTION SetDSequenceMatte(seqID: ImageSequence;matte: PixMapHandle; matteRect: Rect): OSErr;
  363.  INLINE $7011,$AAA3;
  364. FUNCTION SetDSequenceMask(seqID: ImageSequence;mask: RgnHandle): OSErr;
  365.  INLINE $7012,$AAA3;
  366. FUNCTION SetDSequenceTransferMode(seqID: ImageSequence;mode: INTEGER; opColor: RGBColor): OSErr;
  367.  INLINE $7013,$AAA3;
  368. FUNCTION SetDSequenceDataProc(seqID: ImageSequence;dataProc: DataProcRecordPtr;
  369.  bufferSize: LONGINT): OSErr;
  370.  INLINE $7014,$AAA3;
  371. FUNCTION SetDSequenceAccuracy(seqID: ImageSequence;accuracy: CodecQ): OSErr;
  372.  INLINE $7034,$AAA3;
  373. FUNCTION SetDSequenceSrcRect(seqID: ImageSequence; srcRect: Rect): OSErr;
  374.  INLINE $7035,$AAA3;
  375. FUNCTION GetDSequenceImageBuffer(seqID: ImageSequence;VAR gworld: GWorldPtr): OSErr;
  376.  INLINE $7015,$AAA3;
  377. FUNCTION GetDSequenceScreenBuffer(seqID: ImageSequence;VAR gworld: GWorldPtr): OSErr;
  378.  INLINE $7016,$AAA3;
  379. FUNCTION SetCSequenceQuality(seqID: ImageSequence;spatialQuality: CodecQ;
  380.  temporalQuality: CodecQ): OSErr;
  381.  INLINE $7017,$AAA3;
  382. FUNCTION SetCSequencePrev(seqID: ImageSequence;prev: PixMapHandle; prevRect: Rect): OSErr;
  383.  INLINE $7018,$AAA3;
  384. FUNCTION SetCSequenceFlushProc(seqID: ImageSequence;flushProc: FlushProcRecordPtr;
  385.  bufferSize: LONGINT): OSErr;
  386.  INLINE $7033,$AAA3;
  387. FUNCTION SetCSequenceKeyFrameRate(seqID: ImageSequence;keyframerate: LONGINT): OSErr;
  388.  INLINE $7036,$AAA3;
  389. FUNCTION GetCSequenceKeyFrameRate(seqID: ImageSequence; VAR keyframerate: LONGINT): OSErr;
  390.  INLINE $203C,12,75,$AAA3;
  391. FUNCTION GetCSequencePrevBuffer(seqID: ImageSequence;VAR gworld: GWorldPtr): OSErr;
  392.  INLINE $7019,$AAA3;
  393. FUNCTION CDSequenceBusy(seqID: ImageSequence): OSErr;
  394.  INLINE $701A,$AAA3;
  395. FUNCTION CDSequenceEnd(seqID: ImageSequence): OSErr;
  396.  INLINE $701B,$AAA3;
  397. FUNCTION GetCompressedImageSize(desc: ImageDescriptionHandle;data: Ptr;
  398.  bufferSize: LONGINT;dataProc: DataProcRecordPtr;VAR dataSize: LONGINT): OSErr;
  399.  INLINE $701C,$AAA3;
  400. FUNCTION GetSimilarity(src: PixMapHandle; srcRect: Rect;desc: ImageDescriptionHandle;
  401.  data: Ptr;VAR similarity: Fixed): OSErr;
  402.  INLINE $701D,$AAA3;
  403. FUNCTION GetImageDescriptionCTable(desc: ImageDescriptionHandle;VAR ctable: CTabHandle): OSErr;
  404.  INLINE $701E,$AAA3;
  405. FUNCTION SetImageDescriptionCTable(desc: ImageDescriptionHandle;ctable: CTabHandle): OSErr;
  406.  INLINE $701F,$AAA3;
  407. FUNCTION GetImageDescriptionExtension(desc: ImageDescriptionHandle;VAR extension: Handle;
  408.  idType: LONGINT;index: LONGINT): OSErr;
  409.  INLINE $7020,$AAA3;
  410. FUNCTION SetImageDescriptionExtension(desc: ImageDescriptionHandle;extension: Handle;
  411.  idType: LONGINT): OSErr;
  412.  INLINE $7021,$AAA3;
  413. FUNCTION RemoveImageDescriptionExtension(desc: ImageDescriptionHandle; idType: LONGINT; index: LONGINT): OSErr;
  414.  INLINE $203C,12,$003A,$AAA3;
  415. FUNCTION CountImageDescriptionExtensionType(desc: ImageDescriptionHandle; idType: LONGINT; VAR count: LONGINT): OSErr;
  416.  INLINE $203C,12,$003B,$AAA3;
  417. FUNCTION GetNextImageDescriptionExtensionType(desc: ImageDescriptionHandle; VAR idType: LONGINT): OSErr;
  418.  INLINE $203C,8,$003C,$AAA3;
  419. FUNCTION FindCodec(cType: CodecType;specCodec: CodecComponent;VAR compressor: CompressorComponent;
  420.  VAR decompressor: DecompressorComponent): OSErr;
  421.  INLINE $7023,$AAA3;
  422. FUNCTION CompressPicture(srcPicture: PicHandle;dstPicture: PicHandle;quality: CodecQ;
  423.  cType: CodecType): OSErr;
  424.  INLINE $7024,$AAA3;
  425. FUNCTION FCompressPicture(srcPicture: PicHandle;dstPicture: PicHandle;colorDepth: INTEGER;
  426.  clut: CTabHandle;quality: CodecQ;doDither: INTEGER;compressAgain: INTEGER;
  427.  progressProc: ProgressProcRecordPtr;cType: CodecType;codec: CompressorComponent): OSErr;
  428.  INLINE $7025,$AAA3;
  429. FUNCTION CompressPictureFile(srcRefNum: INTEGER;dstRefNum: INTEGER;quality: CodecQ;
  430.  cType: CodecType): OSErr;
  431.  INLINE $7026,$AAA3;
  432. FUNCTION FCompressPictureFile(srcRefNum: INTEGER;dstRefNum: INTEGER;colorDepth: INTEGER;
  433.  clut: CTabHandle;quality: CodecQ;doDither: INTEGER;compressAgain: INTEGER;
  434.  progressProc: ProgressProcRecordPtr;cType: CodecType;codec: CompressorComponent): OSErr;
  435.  INLINE $7027,$AAA3;
  436. FUNCTION GetPictureFileHeader(refNum: INTEGER;VAR frame: Rect;VAR header: OpenCPicParams): OSErr;
  437.  INLINE $7028,$AAA3;
  438. FUNCTION DrawPictureFile(refNum: INTEGER; frame: Rect;progressProc: ProgressProcRecordPtr): OSErr;
  439.  INLINE $7029,$AAA3;
  440. FUNCTION DrawTrimmedPicture(srcPicture: PicHandle; frame: Rect;trimMask: RgnHandle;
  441.  doDither: INTEGER;progressProc: ProgressProcRecordPtr): OSErr;
  442.  INLINE $702E,$AAA3;
  443. FUNCTION DrawTrimmedPictureFile(srcRefnum: INTEGER; frame: Rect;trimMask: RgnHandle;
  444.  doDither: INTEGER;progressProc: ProgressProcRecordPtr): OSErr;
  445.  INLINE $702F,$AAA3;
  446. FUNCTION MakeThumbnailFromPicture(picture: PicHandle;colorDepth: INTEGER;
  447.  thumbnail: PicHandle;progressProc: ProgressProcRecordPtr): OSErr;
  448.  INLINE $702A,$AAA3;
  449. FUNCTION MakeThumbnailFromPictureFile(refNum: INTEGER;colorDepth: INTEGER;
  450.  thumbnail: PicHandle;progressProc: ProgressProcRecordPtr): OSErr;
  451.  INLINE $702B,$AAA3;
  452. FUNCTION MakeThumbnailFromPixMap(src: PixMapHandle; srcRect: Rect;colorDepth: INTEGER;
  453.  thumbnail: PicHandle;progressProc: ProgressProcRecordPtr): OSErr;
  454.  INLINE $702C,$AAA3;
  455. FUNCTION TrimImage(desc: ImageDescriptionHandle;inData: Ptr;inBufferSize: LONGINT;
  456.  dataProc: DataProcRecordPtr;outData: Ptr;outBufferSize: LONGINT;flushProc: FlushProcRecordPtr;
  457.   VAR trimRect: Rect;progressProc: ProgressProcRecordPtr): OSErr;
  458.  INLINE $702D,$AAA3;
  459. FUNCTION ConvertImage(srcDD: ImageDescriptionHandle;srcData: Ptr;colorDepth: INTEGER;
  460.  clut: CTabHandle;accuracy: CodecQ;quality: CodecQ;cType: CodecType;codec: CodecComponent;
  461.  dstDD: ImageDescriptionHandle;dstData: Ptr): OSErr;
  462.  INLINE $7030,$AAA3;
  463. FUNCTION GetCompressedPixMapInfo(pix: PixMapPtr;VAR desc: ImageDescriptionHandle;
  464.  VAR data: Ptr;VAR bufferSize: LONGINT;VAR dataProc: DataProcRecord;VAR progressProc: ProgressProcRecord): OSErr;
  465.  INLINE $7037,$AAA3;
  466. FUNCTION SetCompressedPixMapInfo(pix: PixMapPtr;desc: ImageDescriptionHandle;
  467.  data: Ptr;bufferSize: LONGINT;dataProc: DataProcRecordPtr;progressProc: ProgressProcRecordPtr): OSErr;
  468.  INLINE $7038,$AAA3;
  469. FUNCTION StdPix( src: PixMapPtr;  srcRect :Rect; matrix : MatrixRecordPtr; mode : INTEGER;
  470.     mask: RgnHandle ;  matte: PixMapPtr;  matteRect: Rect; flags : INTEGER ) : OSErr;
  471. INLINE $700C,$AAA3;
  472.  
  473. {   Standard Preview  }
  474.  
  475. PROCEDURE SFGetFilePreview(where: Point;
  476.                     prompt: Str255;
  477.                     fileFilter: FileFilterProcPtr;
  478.                     numTypes: INTEGER;
  479.                     typeList: SFTypeList;
  480.                     dlgHook: DlgHookProcPtr;
  481.                     VAR reply: SFReply);
  482.  INLINE $303C,$41,$AAA3;
  483.  
  484. PROCEDURE SFPGetFilePreview(where: Point;
  485.                      prompt: Str255;
  486.                      fileFilter: FileFilterProcPtr;
  487.                      numTypes: INTEGER;
  488.                      typeList: SFTypeList;
  489.                      dlgHook: DlgHookProcPtr;
  490.                      VAR reply: SFReply;
  491.                      dlgID: INTEGER;
  492.                      filterProc: ModalFilterProcPtr);
  493.  INLINE $303C,$42,$AAA3;
  494.  
  495. PROCEDURE StandardGetFilePreview(fileFilter: FileFilterProcPtr;
  496.                           numTypes: INTEGER;
  497.                           typeList: SFTypeList;
  498.                           VAR reply: StandardFileReply);
  499.  INLINE $303C,$43,$AAA3;
  500.  
  501. PROCEDURE CustomGetFilePreview(fileFilter: FileFilterYDProcPtr;
  502.                         numTypes: INTEGER;
  503.                         typeList: SFTypeList;
  504.                         VAR reply: StandardFileReply;
  505.                         dlgID: INTEGER;
  506.                         where: Point;
  507.                         dlgHook: DlgHookYDProcPtr;
  508.                         filterProc: ModalFilterYDProcPtr;
  509.                         activeList: Ptr;
  510.                         activateProc: ActivateYDProcPtr;
  511.                         yourDataPtr: UNIV Ptr);
  512.  INLINE $303C,$44,$AAA3;
  513.  
  514. FUNCTION MakeFilePreview(resRefNum: INTEGER;  progress: ProgressProcRecordPtr): OSErr;
  515.  INLINE $303C,$45,$AAA3;
  516.  
  517. FUNCTION AddFilePreview(resRefNum: INTEGER; previewType: OSType; previewData: Handle): OSErr;
  518.  INLINE $303C,$46,$AAA3;
  519.  
  520. CONST
  521.     sfpItemPreviewAreaUser = 11;
  522.     sfpItemPreviewStaticText = 12;
  523.     sfpItemPreviewDividerUser = 13;
  524.     sfpItemCreatePreviewButton = 14;
  525.     sfpItemShowPreviewButton = 15;
  526.  
  527. TYPE
  528.  
  529. PreviewResourcePtr = ^PreviewResourceRecord;
  530. PreviewResourceHandle = ^PreviewResourcePtr;
  531. PreviewResourceRecord = RECORD
  532.     modDate : LONGINT;
  533.     version : INTEGER;
  534.     resType : OSType;
  535.     resID : INTEGER;
  536. END;
  537.  
  538. PROCEDURE AlignScreenRect(VAR rp: Rect; alignmentProc:AlignmentProcRecordPtr);
  539.  INLINE $203C,$8,$4C,$AAA3;
  540. PROCEDURE AlignWindow(wp: WindowPtr; front: Boolean; alignmentRect: RectPtr; alignmentProc:AlignmentProcRecordPtr );
  541.  INLINE $203C,$E,$4D,$AAA3;
  542. PROCEDURE DragAlignedWindow(wp: WindowPtr; startPt: Point; VAR boundsRect: Rect; VAR alignmentRect: Rect; alignmentProc:AlignmentProcRecordPtr);
  543.  INLINE $203C,$14,$4E,$AAA3;
  544. FUNCTION DragAlignedGrayRgn(theRgn: RgnHandle; startPt: Point; VAR boundsRect: Rect;
  545.  VAR slopRect: Rect; axis: INTEGER; actionProc: ProcPtr; VAR alignmentRect: Rect; alignmentProc:AlignmentProcRecordPtr): LONGINT;
  546.  INLINE $203C,$1E,$4F,$AAA3;
  547.  
  548. FUNCTION SetCSequenceDataRateParams(seqID: ImageSequence; params: DataRateParamsPtr): OSErr;
  549.  INLINE $203C,$8,$50,$AAA3;
  550. FUNCTION SetCSequenceFrameNumber(seqID: ImageSequence; frameNumber: LONGINT): OSErr;
  551.  INLINE $203C,$8,$51,$AAA3;
  552. FUNCTION NewImageGWorld(VAR gworld: GWorldPtr; idh: ImageDescriptionHandle; flags :GWorldFlags): OSErr;
  553.  INLINE $203C,$C,$52,$AAA3;
  554. FUNCTION GetCSequenceDataRateParams(seqID: ImageSequence; params: DataRateParamsPtr): OSErr;
  555.  INLINE $203C,$8,$53,$AAA3;
  556. FUNCTION GetCSequenceFrameNumber(seqID: ImageSequence; VAR frameNumber: LONGINT): OSErr;
  557.  INLINE $203C,$8,$54,$AAA3;
  558. FUNCTION GetBestDeviceRect(VAR gdh: GDHandle; VAR rp: Rect): OSErr;
  559.  INLINE $203C,$8,$55,$AAA3;
  560.  
  561.  
  562. CONST
  563.  identityMatrixType            = $00;                         { result if matrix is identity }
  564.  translateMatrixType        = $01;                         { result if matrix translates }
  565.  scaleMatrixType            = $02;                         { result if matrix scales }
  566.  scaleTranslateMatrixType    = $03;                         { result if matrix scales and translates }
  567.  linearMatrixType            = $04;                         { result if matrix is general 2 x 2 }
  568.  linearTranslateMatrixType    = $05;                         { result if matrix is general 2 x 2 and translates }
  569.  perspectiveMatrixType        = $06;                         { result if matrix is general 3 x 3 }
  570.  
  571.  
  572. FUNCTION GetMatrixType( m: MatrixRecord): INTEGER;
  573.  INLINE $7014,$ABC2;
  574. PROCEDURE CopyMatrix(m1: MatrixRecord;VAR m2: MatrixRecord);
  575.  INLINE $7020,$ABC2;
  576. FUNCTION EqualMatrix(m1: MatrixRecord; m2: MatrixRecord): BOOLEAN;
  577.  INLINE $7021,$ABC2;
  578. PROCEDURE SetIdentityMatrix(VAR matrix: MatrixRecord);
  579.  INLINE $7015,$ABC2;
  580. PROCEDURE TranslateMatrix(VAR m: MatrixRecord;deltaH: Fixed;deltaV: Fixed);
  581.  INLINE $7019,$ABC2;
  582. PROCEDURE RotateMatrix(VAR m: MatrixRecord;degrees: Fixed;aboutX: Fixed;
  583.  aboutY: Fixed);
  584.  INLINE $7016,$ABC2;
  585. PROCEDURE ScaleMatrix(VAR m: MatrixRecord;scaleX: Fixed;scaleY: Fixed;aboutX: Fixed;
  586.  aboutY: Fixed);
  587.  INLINE $7017,$ABC2;
  588. PROCEDURE SkewMatrix(VAR m: MatrixRecord;skewX: Fixed;skewY: Fixed;aboutX: Fixed;
  589.  aboutY: Fixed);
  590.  INLINE $7018,$ABC2;
  591. FUNCTION TransformFixedPoints( m: MatrixRecord;VAR fpt: FixedPoint;count: LONGINT): OSErr;
  592.  INLINE $7022,$ABC2;
  593. FUNCTION TransformPoints( mp: MatrixRecord;VAR pt1: Point;count: LONGINT): OSErr;
  594.  INLINE $7023,$ABC2;
  595. FUNCTION TransformFixedRect( m: MatrixRecord;VAR fr: FixedRect;VAR fpp: FixedPoint): BOOLEAN;
  596.  INLINE $7024,$ABC2;
  597. FUNCTION TransformRect( m: MatrixRecord;VAR r: Rect;VAR fpp: FixedPoint): BOOLEAN;
  598.  INLINE $7025,$ABC2;
  599. FUNCTION TransformRgn( mp: MatrixRecord;r: RgnHandle): OSErr;
  600.  INLINE $7039,$AAA3;
  601. FUNCTION InverseMatrix(m: MatrixRecord; VAR im: MatrixRecord): BOOLEAN;
  602.  INLINE $701C,$ABC2;
  603. PROCEDURE ConcatMatrix(a: MatrixRecord;VAR b: MatrixRecord);
  604.  INLINE $701B,$ABC2;
  605. PROCEDURE RectMatrix(VAR matrix: MatrixRecord; srcRect: Rect; dstRect: Rect);
  606.  INLINE $701E,$ABC2;
  607. PROCEDURE MapMatrix(VAR matrix: MatrixRecord; fromRect: Rect; toRect: Rect);
  608.  INLINE $701D,$ABC2;
  609.  
  610.  
  611. {$ENDC} { UsingImageCompression }
  612.  
  613. {$IFC NOT UsingIncludes}
  614.  END.
  615. {$ENDC}
  616.